#ifndef GUI_PCONFIG_H
#define GUI_PCONFIG_H

#include <unistd.h>
#include <string.h>
#include <stdint.h>

enum
{
    WORD_TYPE_INT,
    WORD_TYPE_UINT,
    WORD_TYPE_HEX,
    WORD_TYPE_BIN,
    WORD_TYPE_BCD,
    WORD_TYPE_ENUM0,
    WORD_TYPE_ENUM,
    WORD_TYPE_ENUM2,
    WORD_TYPE_ENUM3,
    WORD_TYPE_ENUM4,
    WORD_TYPE_ENUM5,
    WORD_TYPE_ENUM6,
    WORD_TYPE_ENUM7,
    WORD_TYPE_ENUM8,
    WORD_TYPE_ENUM9,
    WORD_TYPE_ADD15,
    WORD_TYPE_ADD40,
    WORD_TYPE_ADD100,
    WORD_TYPE_ADD5000,
    WORD_TYPE_MUL2,
    WORD_TYPE_MUL2_ADD50,
    WORD_TYPE_MUL2_ADD60,
    WORD_TYPE_MUL10,
    WORD_TYPE_MUL100,
    WORD_TYPE_MUL10_ADD300,
    WORD_TYPE_DIV2,
    WORD_TYPE_DIV6,
    WORD_TYPE_DIV10,
    WORD_TYPE_DIV15,
    WORD_TYPE_DIV100,
    WORD_TYPE_ERRCODE,
    WORD_TYPE_RTCSET,
    WORD_TYPE_RESET,
    WORD_TYPE_WIFI,
    WORD_TYPE_NULL,
    WORD_TYPE_SENSOR,
    WORD_TYPE_VER1,
    WORD_TYPE_VER2,
    WORD_TYPE_MODE,
    WORD_TYPE_TEMP,
    WORD_TYPE_DVER,
    WORD_TYPE_DVER2,
    WORD_TYPE_MACH,
    WORD_TYPE_REV,
    WORD_TYPE_MAX
};

typedef struct disp_enum_t
{
    uint8_t value;
    char *name[3];
}disp_enum_t;

typedef struct disp_ui_word_t
{
    void* addr;
    char *name[3];
    uint16_t word;
    uint8_t start;
    uint8_t len;
    int16_t min;
    int16_t max;
    uint8_t type;
    disp_enum_t *_enum;
    char *unit;
}disp_ui_word_t;

typedef struct disp_ui_set_t
{
    void* addr;
    char *name[3];
    uint8_t type;
    int16_t *value;
    int16_t min;
    int16_t max;
    disp_enum_t *_enum;
    uint8_t enum_len;
}disp_ui_set_t;

typedef struct sys_error_tab_t {
    char* name[3];
}sys_error_tab_t;

typedef struct max_min_value_t {
    int min;
    int max;
}max_min_value_t;

extern int16_t g_set_reg[10];

extern const char *disp_week[3][7];
extern const char *string_fault[3];
extern const char* string_return[3];
extern const char* disp_active[3][2];
extern const char* string_comm_err[3];
extern const char* string_password_error[3];
extern const char* string_no_err[3];

/*-----------screen_1-----------*/
extern const char* string_hum[3];
extern const char* string_env_temp[3];
extern const char* string_pm25_temp[3][3];
extern const char* disp_menu_item[3][6];
extern const char* disp_work_mode_1[3][3];
extern const char* disp_work_mode_2[3][3];
extern const char* disp_switch[3][2];

/*-----------screen_2-----------*/
extern const char *string_mode_enum[3][3];
extern const char *string_setting_fan[3][4];
extern const char* string_set_temp[3];

/*-----------screen_3-----------*/
extern const char* string_fan_speed[3];
extern const char* string_out_fan_temp[3];
extern const char* disp_switch_time[3][2];

/*-----------screen_4-----------*/
extern const char *string_temp[3];
extern const char* disp_screen_4_item_1[3][7];
extern const char* string_dew_point_temp[3];
extern const char* disp_screen_4_item_2[3][4];

/*-----------screen_5-----------*/
extern const char* disp_screen_5_item_1[3][5];
extern const char* disp_paging[3][2];
extern const char* string_status_param[3];

/*-----------screen_6-----------*/
extern const char* disp_screen_6_item_1[3][5];
extern const char* string_set_param[3];


/*-----------screen_7-----------*/
extern const char* disp_screen_7_item_1[3][3];
extern const disp_enum_t set_enum4[3];
extern const disp_enum_t set_enum6[2];


extern const disp_ui_set_t disp_ui_set[];
extern const disp_ui_word_t check0_ui_word[];
extern const disp_ui_word_t seting0_ui_word[];
extern const sys_error_tab_t g_sys_error_tab[];

extern const uint16_t sys_error_tab_size;
extern const uint16_t disp_ui_set_size;
extern const uint16_t check0_ui_word_size;
extern const uint16_t seting0_ui_word_size;


char *fun_draw_ui_word(const disp_ui_word_t *disp_ui_word, char *pString, uint16_t reg_value);
#endif